package com.takanafu.haru.code{
	import mx.collections.ArrayCollection;
	import mx.collections.IViewCursor;
	
	public class CodeBlock extends CodeBase{
		private var list:ArrayCollection;
		
		public function CodeBlock(ary:ArrayCollection){
			this.list = ary;
		}
		override public function run():CodeBase{
			var code:CodeBase = CodeBoolean.True;
			
			if(this.list != null){
				var cursor:IViewCursor = this.list.createCursor();
				
				while(cursor.afterLast == false){
					var c:CodeBase = cursor.current as CodeBase;
					
					if(c != null){
						c.thread = this.thread;
						var ret:CodeBase = c.run();
						
						if(ret is UseCallback){
							return ret;
						}
					}
					cursor.moveNext();
				}
			}
			return code;
		}
	}
}